package wisp.gui;

//GTGE GUI
import java.awt.Color;

import wisp.game.PlayerSprite;

import com.golden.gamedev.gui.*;
import com.golden.gamedev.gui.toolkit.*;

public class BlurseWindow extends TFloatPanel{

	public PlayerSprite player;
	private GUImanager frame;
	
	private TPanel factionPane;
	private TLabel factionName;
	private TLabel currentFavorPoints;
	private TLabel currentDeedPoints;
	
	private TPanel[] blursePanel = new TPanel[3];
	public TLabel[] blurseName = new TLabel[3];
	private TLabel[] blurseDeed = new TLabel[3];
	private TLabel[] blurseDescription = new TLabel[3];
	private TLabel[] blurseLevel = new TLabel[3];
	private Cbutton[] blurseUse = new Cbutton[3];
	
	private int blurseCount;
	
	public BlurseWindow(String name, PlayerSprite p, GUImanager g){
		super(name, true, true, 205, 155, 350, 410);
		
		player = p;
		frame = g;
		blurseCount = 0;
		
		factionPane = new TPanel(5, 5, 60, 60);
		factionName = new TLabel("Fascia", 80,5,100,20);
		currentFavorPoints = new TLabel("11FP", 190,5,80,20);
		currentDeedPoints = new TLabel("99DP", 190,30,80,20);
		
		blursePanel[0] = new TPanel(0,80,350,100);
		blursePanel[1] = new TPanel(0,180,350,100);
		blursePanel[2] = new TPanel(0,280,350,100);
		
		blursePanel[0].UIResource().put("Background Color", Color.GRAY.darker());
		blursePanel[1].UIResource().put("Background Color", Color.GRAY.darker());
		blursePanel[2].UIResource().put("Background Color", Color.GRAY.darker());
		
		this.add(factionName);
		this.add(factionPane);
		this.add(currentDeedPoints);
		this.add(currentFavorPoints);
		this.add(blursePanel[0]);
		this.add(blursePanel[1]);
		this.add(blursePanel[2]);

		
	}
	
	public void addSkill(int pos, String name, String dpCost, String description){
		blurseName[pos] = new TLabel(name, 5, 5, 100, 20);
		blurseLevel[pos] = new TLabel("Lv.1" , 110, 5, 40, 20);
		blurseDeed[pos] = new TLabel(dpCost+" Deed Pts", 180, 5, 100, 20);
		blurseDescription[pos] = new TLabel(description, 5, 30, 300, 70);
		
		blurseUse[pos] = new Cbutton("Use", 300, 5, 40,40);
		
		blursePanel[pos].add(blurseName[pos]);
		blursePanel[pos].add(blurseLevel[pos]);
		blursePanel[pos].add(blurseDeed[pos]);
		blursePanel[pos].add(blurseDescription[pos]);
		
		blursePanel[pos].add(blurseUse[pos]);
		blursePanel[pos].UIResource().put("Background Color", Color.GRAY.brighter());
		
		blurseCount++;
	}
	
	private void doAction(int n){
		//let the player input the target's name first
		//then notify the server
		//finally, notify the user of the status once the server recieves the order~
	}
	
	public boolean recievedAction(String message){
		boolean result = false;
		
		return result;
	}
	
	public void updateThis(){
		
		for(int i = 0; i < blurseCount; i++){
			if(blurseUse[i].clicked()){
				System.out.println("Blurse " + i + " clicked");
				//doAction(1);
				frame.setCurseSelected(i);
				blurseUse[i].clearClick();
			}
		}
	}
	
}
